//
//  ResolveXML.m
//  takeout
//
//  Created by Mac on 12-2-18.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import "ResolveXML.h"
#import "GDataXMLNode.h"
#import "Constants.h"
@implementation ResolveXML

//获得XML文件
-(GDataXMLDocument *)getXMLDocument:(NSString *)urlString{
//    CUSTOM_LOG(urlString);
    NSURL *url = [[NSURL alloc] initWithString:[urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
    NSMutableURLRequest* request = [NSMutableURLRequest new];    
    [request setURL:url];    
    [request setHTTPMethod:@"GET"]; 
    NSHTTPURLResponse* response;    

    
    NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:nil]; 
    NSString* responseXMLResult=[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
    NSError *error;
    doc = [[GDataXMLDocument alloc] initWithXMLString: responseXMLResult options:0 error:&error];



    return doc;
}

@end
